name: Android CI

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

concurrency:
  group: build-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build_android:
    name: Build Android App
    runs-on: macos-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Validate Gradle Wrapper
        uses: gradle/wrapper-validation-action@v1

      - name: Set up JDK 18
        uses: actions/setup-java@v3
        with:
          distribution: 'zulu'
          java-version: 18
          cache: gradle

      - name: Build App
        run: ./gradlew :androidApp:app:build

  build_ios:
    name: Build iOS App
    runs-on: macos-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Validate Gradle Wrapper
        uses: gradle/wrapper-validation-action@v1

      - name: Set up JDK 18
        uses: actions/setup-java@v1
        with:
          java-version: 18

      - name: Initialize pods
        run: ./gradlew shared:umbrella:podInstall

      - name: Build App
        run: xcodebuild -workspace iosApp/iosApp.xcworkspace -configuration Debug -scheme iosApp -sdk iphonesimulator